There have been proposed image forming apparatuses including cartridges, each of which includes: a container that has a light transmitting window; and an agitating member that is positioned in the container and agitates toner. Among them, there have been disclosed a technology to detect an amount of toner remaining in the container on the basis of a result of receiving incident light from the light transmitting window which varies by agitation of the agitating member, and to identify the kind of a cartridge on the basis of at least one of an incident-light receiving interval and the number of times the incident light is received for a predetermined period.